import {
  getFormatterPrice,
  computeRate
} from '@const/filter'
// 产品大类
export const PRODUCT_CATEGORY = {
  1: '高值',
  2: '低值',
  3: '试剂',
  4: '设备',
  5: '低值'
}
// 管理分类
export const PRODUCT_MANAGE_CATEGORY = {
  1: 'Ⅰ类',
  2: 'Ⅱ类',
  3: 'Ⅲ类'
}
// 注册地
export const PRODUCT_REGISTER_TYPE = {
  0: '国产',
  1: '港澳台',
  2: '进口'
}
export const saleOrderProductListColumns = [
  {
    prop: 'companyCode',
    label: '配送商产品编码',
    minWidth: 160
  },
  {
    prop: 'deliveryProductName',
    label: '配送商产品名称',
    minWidth: 160
  },
  {
    prop: 'spec',
    label: '规格型号',
    minWidth: 120,
    showTooltipWhenOverflow: true,
    formatter: row => `${row.spec && row.model ? `${row.spec} ${row.model}` : row.model || row.spec ? `${row.model || row.spec}` : ''}`
  },
  {
    prop: 'manufacturer',
    label: '生产厂家',
    minWidth: 120,
    showTooltipWhenOverflow: true
  },
  {
    prop: 'registrationNumber',
    label: '注册证号/备案证号',
    minWidth: 180,
    showTooltipWhenOverflow: true
  },
  {
    prop: 'manageType',
    label: '管理分类',
    minWidth: 120,
    formatter: row => PRODUCT_MANAGE_CATEGORY[row.manageType]
  },
  {
    prop: 'price',
    label: '单价（元）',
    minWidth: 120,
    formatter: row => getFormatterPrice(row.price || 0)
  },

  {
    prop: 'purchaseNum',
    label: '订单数量',
    width: 160
  },
  {
    prop: 'unit',
    label: '计量单位',
    minWidth: 120
  },
  {
    prop: 'amount',
    label: '小计金额（元）',
    minWidth: 120,
    showTooltipWhenOverflow: true
  },

  {
    prop: 'registerArea',
    label: '注册地',
    minWidth: 120,
    formatter: row => PRODUCT_REGISTER_TYPE[row.registerArea]
  },
  {
    prop: 'bigType',
    label: '产品大类',
    minWidth: 120,
    formatter: row => PRODUCT_CATEGORY[row.bigType]
  },
  {
    minWidth: 160,
    prop: 'provincePlatCode',
    label: '省平台产品编码',
    showTooltipWhenOverflow: true
  },
  {
    minWidth: 160,
    prop: 'platCode',
    label: 'M平台产品编码',
    showTooltipWhenOverflow: true
  },
  {
    width: 60,
    prop: 'action',
    label: '操作',
    fixed: 'right'
  }
]
export const purchaseOrderProductListColumns = [
  { width: 60, type: 'selection', align: 'center' },
  { minWidth: '150', prop: 'itemCode', label: '产品编码', 'show-overflow-tooltip': true },
  { minWidth: '120', prop: 'nameCn', label: '产品名称', 'show-overflow-tooltip': true },
  { minWidth: '110', prop: 'specification', label: '规格', 'show-overflow-tooltip': true },
  { minWidth: '110', prop: 'productType', label: '型号', 'show-overflow-tooltip': true },
  { width: '80', prop: 'minUnit', label: '最小单位' },
  // { width: '110', prop: 'buyPrice', label: '单价（元）', formatter: row => getFormatterPrice(row.buyPrice || 0) },
  { width: '190', prop: 'price', label: '采购价格（元）' },
  { width: '120', prop: 'templatePrice', label: '模板价格（元）' },
  { width: '120', prop: 'priceDifference', label: '价格差异（元）' },

  { minWidth: '170', prop: 'registrationNumber', label: '注册证号/备案证号', 'show-overflow-tooltip': true },
  { width: 180, prop: 'manufacturer', label: '生产厂家', 'show-overflow-tooltip': true },
  {
    width: '80',
    prop: 'category',
    label: '产品大类',
    formatter: row => PRODUCT_CATEGORY[row.category]
  },
  { width: '190', prop: 'purchaseNum', label: '采购数量' },
  { width: '130', prop: 'detailAmount', label: '小计金额（元）', formatter: row => getFormatterPrice(row.detailAmount || 0) },
  { width: '180', prop: 'supplierName', label: '供应商', 'show-overflow-tooltip': true },
  { width: '150', prop: 'platCode', label: '平台产品编码', 'show-overflow-tooltip': true },
  { width: '60', prop: 'action', label: '操作', fixed: 'right' }
]
